import BigImg from '../../../components/BigImg-pc/index.vue'
export  default{
  data(){
    return {
      imgIndex:-1,
      imgSwitch:false,
      reportList: {},
      photosList:[],
      noticekey:'noticekey1', //Notice弹窗name
      showWarnModal:false, //格式校验提示框
      warnContent:''  //提示文案
    }
  },
  mounted(){
    this.init();
  },
  methods:{
    init: function(){
      var _this=this;
      var params={
        id: this.$route.params.idNum
      };
      _this.$http.post('convphotoManage/queryPublishedConvDetailById ',params).then(function (data) {
      // _this.$http.get('/static/data/getReportDoneDetailById.json',params).then(function (data) {
          if(data.meta.code == '0'){
            data = data.data
            _this.reportList = data||{};
            _this.photosList = data.photos;
            console.log( _this.reportList);
          }else{
            // _this.$Modal.warning({
            //   title: '温馨提示',
            //   content: data.meta.message
            // });
            _this.showWarnModal = true;
            _this.warnContent = data.meta.message;
          }
        })
          .catch(function(err){
            // _this.$Modal.warning({
            //   title: '温馨提示',
            //   content: err.meta.message
            // });
            _this.showWarnModal = true;
            _this.warnContent = err.meta.message;
          })
    },
    bigImg(index){
      this.imgIndex=index;
      this.imgSwitch=true
    },
    goToSubject: function(item){
      this.$router.push({
        name: "subjectDetail",
        query:{
          subjectId:item.subjectId
        }
      })
    },
    reset(){
      this.imgIndex=-1
    },
    switchShow(){
      var _this=this;
      var params={
        id: this.$route.params.idNum,
        showFlag: this.reportList.showFlag==1 ? 2:1
      };
      this.$Notice.close(_this.noticekey);
      this.$http.post("convphotoManage/switchShowOrHide",params).then(
        function(data){
          if(data.meta.code==0){
            _this.reportList.showFlag = params.showFlag;
            _this.$Notice.success({
              title: '温馨提示',
              desc: '操作成功',
              name:_this.noticekey,
              duration:2,
            });
          }else{
            // _this.$Modal.warning({
            //   title: '温馨提示',
            //   content: data.meta.message
            // });
            _this.showWarnModal = true;
            _this.warnContent = data.meta.message;
          }
        }
      ).catch(function(err){
        // _this.$Modal.warning({
        //   title: '温馨提示',
        //   content: err.meta.message
        // });
        _this.showWarnModal = true;
        _this.warnContent = err.meta.message;
      });
    },
    closeModal(){
      this.showWarnModal = false;
    }
  },
  components:{
    'big-img':BigImg
  }
}
